package com.teufandsub.socialproximity.gui;

import android.content.Intent;

import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.teufandsub.socialproximity.R;
import com.teufandsub.socialproximity.controller.Controller;

/**
 * @author Bastien Mathias <bastienmathias@gmail.com>
 * @author Antoine Teuf <antoine.teuf@gmail.com>
 * @version 1.0
 * @since 2013-05-22
 * 
 * Abstract class to set the menu options for view in our application.
 */

public abstract class SocialProxActivity extends SherlockActivity {

	protected Controller controller;
	
	public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
		MenuInflater inflater = this.getSupportMenuInflater();
		inflater.inflate(R.menu.main_menu, menu);
		return true;
	};
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		Intent intent;
		switch(item.getItemId()){
			case R.id.action_close:
				intent = new Intent(this, CloseActivity.class);
				startActivity(intent);
				break;
			case R.id.action_home_button:
				intent = new Intent(this, HomeActivity.class);
				startActivity(intent);
				break;
			case R.id.action_home:
				intent = new Intent(this, HomeActivity.class);
				startActivity(intent);
				break;
			case R.id.action_log_out: 
				controller.disconnect(this);
				break;
			default:;
		}
		return true;
	}
}
